<?php
//登录操作的路由
Route::group(['middleware' => 'web', 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
//    登陆的操作不需要进行判断
    Auth::routes();
});
//系统默认系统路由（开发展示首页）
Route::group(['middleware' =>['web','auth:admin'], 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
    //加载系统默认的登陆管理的路由
    Route::get('/', 'AdminController@index');
 });
//管理资源路由
Route::group(['middleware' =>['web','auth:admin','permission:admin,resource'], 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
    //加载用户管理资源的路由
    Route::resource('/adminuser','AdminUserController');
    //加载角色管理资源路由
    Route::resource('/role','RoleController');
});
//普通路由
Route::group(['middleware' =>['web','auth:admin','permission:admin'], 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
    //加载权限模板路由
    Route::get('/showPermission/{roleid}','RoleController@showPermission')->name('showPermission');
    //加载管理权限的路由
    Route::post('/permission/{roleid}','RoleController@permission')->name('permission');
    //用户分配角色加载模板路由
    Route::get('/showRole/{adminid}','AdminUserController@showRole')->name('showRole');
    //加载处理分配角色的路由
    Route::post('/assignRole/{adminid}','AdminUserController@assignRole')->name('assignRole');
});

 
//module-route
Route::group(['middleware' => ['web', 'auth:admin'],'prefix'=>'admin','namespace'=>"Modules\Admin\Http\Controllers"], 
function () {
    //模块列表
    Route::get('/module','ModuleController@index')->name('module');
    //更新模块路由
    Route::get('/updateCache','ModuleController@updateCache')->name('updateCache');
    //设为默认模块路由
    Route::get('/setDfaulet/{module}','ModuleController@setDefaultModule')->name('setDfaulet');
    //后台显示模板路由
    Route::get('/template','TemplateController@index')->name('template');
    //后台管理模板路由
    Route::get('/setDefaultTemplate/{name}','TemplateController@setDefaultTemplate')->name('setDefaultTemplate');
});